{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="/app02/login/" method="post" id="myform">
    用户名：<input type="text" name="user_name" id="user_name"><br>
    密码：<input type="password" name="user_password" id="user_password"><br>
    验证码：<input type="text" name="identify_page">
    <img src="{% url 'app02:identifycode' %}"> <a href="javascript:void(0)">看不清</a><br>
    <br>
    <hr>
    记住密码：
    <input type="radio" name="save_time" value="week"> 一周
    <input type="radio" name="save_time" value="month"> 一月
    <input type="radio" name="save_time" value="year"> 一年
    <br>
    <input type="submit" value="提交">
    <input type="reset" value="重置">
</form>

<script type="text/javascript" src="{% static 'js/jquery-3.3.1.js' %}"></script>
<script type="text/javascript">
    $(function () {
        $('#user_name').blur(function () {
            v_content = $('#myform').serialize()
            $.post('/app02/login_name_password/', v_content, function (backdate, statetext, xhr) {
                v_password_content = backdate.password
                if (v_password_content != '') {
                    $('#user_password').val(v_password_content)
                }
            })


        });
        $('a').click(function () {
            var v_date = new Date();
            var path = '/app02/identifycode/?id=' + v_date.getTime();
            $('img').attr('src', path);
            return false;
        });
    });


</script>
</body>
</html>